<script setup lang="ts" name="welcome">
import { onMounted, ref } from 'vue';
import * as echarts from 'echarts'

const chartRef = ref(null);

onMounted(() => {
    if (chartRef.value) {
        const myChart = echarts.init(chartRef.value);
        const option = {
            tooltip: {
                trigger: 'item'
            },
            legend: {
                top: '5%',
                left: 'center'
            },
            series: [
                {
                    name: '技术',
                    type: 'pie',
                    radius: ['40%', '70%'],
                    avoidLabelOverlap: false,
                    label: {
                        show: false,
                        position: 'center'
                    },
                    emphasis: {
                        label: {
                            show: true,
                            fontSize: 40,
                            fontWeight: 'bold'
                        }
                    },
                    labelLine: {
                        show: false
                    },
                    data: [
                        { value: 1048, name: 'nodejs' },
                        { value: 735, name: 'express' },
                        { value: 580, name: 'mysql' },
                        { value: 484, name: 'vue3' },
                        { value: 300, name: 'element plus'},
                        { value: 200, name: 'vite'},
                        { value: 200, name: 'pinia'},
                        { value: 200, name: 'axios'},
                        { value: 200, name: 'vue-router'}
                    ]
                }
            ]
        };
        myChart.setOption(option);
    }
})

</script>
<template>
    <el-row :gutter="12" class="two">
        <el-col :span="24">
            <el-card shadow="never">
                <div class="list-title">技术架构</div>
                <div class="list">服务架构：nodejs、express、mysql</div>
                <div class="list">前端架构：vue3、element plus、vite、pinia、axios、vue-router</div>
            </el-card>
        </el-col>
    </el-row>
    <el-row :gutter="12" class="two">
        <el-col :span="24">
            <el-card shadow="never">
                <div class="echarts-box">
                    <div ref="chartRef" style="width: 100%; height: 400px;"></div>
                </div>
            </el-card>
        </el-col>
    </el-row>
</template>

<style scoped lang="scss">
.one {
    .el-card {
        display: flex;
        justify-content: center;
    }
}

.two {
    .list-title {
        font-size: 24px;
    }

    .list {
        margin-top: 10px;
    }
    .echarts-box{
        display: flex;
        justify-content: center;
    }
}

.el-row {
    margin-bottom: 6px;
}

.art-box {
    text-align: center;

    .art-name {
        margin: 5px 0;
    }
}
</style>